首先會從github,看看README了解requests想解決的問題和範圍。
再來觀察requests的程式碼與目錄結構,針對想理解的程式碼看內部的實現
除了學習模組化寫法和架構之外,還可以了解python或HTTP的工作原理。
解決的問題與範圍
Requests is an elegant and simple HTTP library for Python, built for human beings.
Requests allows you to send organic, grass-fed HTTP/1.1 requests, without the need for manual labor.
Feature Support
- International Domains and URLs
-
Keep-Alive & Connection Pooling
-
Sessions with Cookie Persistence
-
Browser-style SSL Verification
- Basic/Digest Authentication
- Elegant Key/Value Cookies
- Automatic Decompression
- Automatic Content Decoding
- Unicode Response Bodies
-
Multipart File Uploads
-
HTTP(S) Proxy Support
- Connection Timeouts
-
Streaming Downloads
- .netrc Support
-
Chunked Requests
想關注的檔案與目錄
- setup.py
- Makefile
- docs
- requests
- tests